package main

import (
	"fmt"
	"path/filepath"
)

func main() {
	paths := []string{
		"/home/arnie/amelia.jpg",
		"/mnt/photos/",
		"rabbit.jpg",
		"/usr/local//go",
	}
	fmt.Println("On Unix:")

	for _, p := range paths {
		dir, file := filepath.Split(p)
		fmt.Printf("input: %q\n\tdir: %q\n\tfile: %q\n", p, dir, file)
	}
	//On Unix:
	//input: "/home/arnie/amelia.jpg"
	//	dir: "/home/arnie/"
	//	file: "amelia.jpg"
	//input: "/mnt/photos/"
	//	dir: "/mnt/photos/"
	//	file: ""
	//input: "rabbit.jpg"
	//	dir: ""
	//	file: "rabbit.jpg"
	//input: "/usr/local//go"
	//	dir: "/usr/local//"
	//	file: "go"
}
